<extend name="Public/base"/>

<block name="body">

    <!-- <div class="main-title">
        <h2>订单列表</h2>
    </div> -->
    <div class="cf" style="margin-top: 5px;margin-left:-50px;margin-bottom:10px;">
            <div style="float: left;padding-left: 50px;" class="">账户总余额：<span style="color: #ff6600">{$sum.total}</span>元</div>
            <div style="float: left;padding-left: 50px;" class="">总分润:<span style="color: #c43c35">{$sum.divide}</span>元</div>
            <div style="float: left;padding-left: 50px;" class="">总交易量:<span style="color: #c43c35">{$sum.t_money}</span>元</div>
            <div style="float: left;padding-left: 50px;" class="">今日进账：<span style="color: #0000ff">{$sum.td_in}</span>元</div>
            <div style="float: left;padding-left: 50px;" class="">今日提现:<span style="color: #c43c35">{$sum.td_out}</span>元</div>

        </div>

    <div class="cf">
        <div class="fl">
            <a class="btn" href="{:U('xyk_dingdan?type=today')}">只看今日</a>
            <a class="btn" href="{:U('xyk_dingdan?type=success')}">交易成功</a>
            <a class="btn" href="{:U('xyk_dingdan?type=fail')}">交易失败</a>
            <!-- <button class="btn today" >只看今日</button>
            <button class="btn success" >交易完成</button>
            <button class="btn fail" >交易失败</button> -->

        </div>
        <php>
            $LOAN_STATUS = C('LOAN_STATUS');
        </php>
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
            <div class="sleft">
               

                <input name="title" class="search-input" style="200px;" value="" placeholder="订单号、商户编号、店铺名" type="text">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('find_dingdan?id=2')}"><i class="btn-search"></i></a>

            </div>

        </div>
    </div>

    <div class="data-table table-striped" >
        <table style="font-size:14px;">
            <thead>
                <tr>
                    <th>店铺名称</th>
                    <th>收款商户（编号）</th>
                    <th>收款金额</th>
                    <th>收款时间</th>
                    <th>收款状态</th>
                    <th>转账金额</th>
                    <th>转账时间</th>
                    <th>转账状态</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <notempty name="_list">
                <volist name="_list" id="rows">
                    <tr>
                        <php>
                            $one=D('Ptyh')->where('uid='.$rows['uid'])->find();
                            
                        </php>
                        <td style="font-size:13px;">{$one['shop_name']}</td>
                        <td>{$one['yh_uid']}</td>
                        <td>{$rows['pay_money']}</td>
                        <td style="font-size:13px;">
                            <php>
                                if(empty($rows['pay_time'])){
                                echo '';
                            }else{
                                echo date("Y-m-d H:i:s",$rows['pay_time']);
                            }
                            </php>
                        </td>
                        <td style="font-size:13px;">
                            <php>
                                if($rows['status']==1){
                                    echo '交易成功';
                                    
                                }else{
                                    echo '<font style="color:#FF3030">交易失败</font>';
                                }
                            </php>
                        </td>

                        <php>
                            $trans=D('Trans')->where(['trade_no'=>$rows['trade_no']])->find();
                        </php>

                        <td>

                            <php>
                                if(empty($trans)){

                                }else{
                                    echo $trans['money'];
                                }
                                
                            </php>

                        </td>
                        <td style="font-size:13px;">
                            <php>
                                if(empty($trans['time'])){
                                echo '';
                            }else{
                                echo $trans['time'];
                            }
                            </php>
                        </td>
                        <td style="font-size:13px;">
                            <php>
                                if(empty($trans)&&$rows['status']==1){
                                    echo "不回款交易";
                                }else if(!empty($trans)){
                                    if($trans['status']==1){
                                        echo '交易成功';
                                        
                                    }else{
                                        echo '<font style="color:#FF3030">交易失败</font>';
                                    }
                                }else{
                                        echo '<font style="color:#FF3030">交易失败</font>';
                                }
                                
                            </php>
                        </td>
                            
     
                        
                        <td>

                            &nbsp;&nbsp;
                            <a title="详细" href="{:U('dingdan_view?id='.$rows['id'])}&type=1">详细</a>
                        </td>
                    </tr>
                </volist>
                <else/>
                <td colspan="14" class="text-center"> aOh! 暂时还没有内容! </td>
                </notempty>
            </tbody>
        </table>



    </div>


    <div class="page"  style="float:left;margin-right:300px;margin-top:20px;">{$_page}</div>
</block>

<block name="script">
    <link href="/Public/static/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <link href="/Public/static/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/Public/static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="/Public/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
    $(function(){
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var status = $("#sch-sort-txt").attr("data");
            var type   = $("#sch-sort-txt_type").attr("data");
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if(status != ''){
                query += '&status=' + status + "&" + query;
            }
            if(type != ''){
                query += '&type=' + type + "&" + query;
            }
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });

        Think.setValue("extend", {$info.extend|default=0});
        //导航高亮
        highlight_subnav('{:U('xyk_dingdan')}');

            //回车搜索
    $(".search-input").keyup(function(e){
        if(e.keyCode === 13){
            $("#search").click();
            return false;
        }
    });











    })


</script>
</block>